package singleton.normal;

/**
 * Title: SingletonDoubleCheck <br>
 * Description: <br>
 * Copyright (c) 传化物流版权所有 2017 <br>
 * Created DateTime: 2017-3-7 12:19
 * Created by Wentao.Shi.
 */
public class SingletonDoubleCheck {
    /* 持有私有静态实例，防止被引用，此处赋值为null，目的是实现延迟加载 */
    private static SingletonDoubleCheck instance = null;
    /* 私有构造方法，防止被实例化 */
    private SingletonDoubleCheck() {
    }
    /* 静态工程方法，创建实例 */
    public static SingletonDoubleCheck getInstance() {
        if (instance == null) {
            synchronized (instance) {
                if (instance == null) {
                    instance = new SingletonDoubleCheck();
                }
            }
        }
        return instance;
    }
}
